package com.ktjy.crm.controller;

import com.ktjy.crm.entity.User;
import com.ktjy.crm.mapper.UserMapper;
import com.ktjy.crm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description
 * @Author 李楚鹏
 * @Date 2025/1/3 下午7:03
 **/
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/findAll")
    public List<User> findAll() {
        return userService.findAll();
    }

    @RequestMapping("/delete/{id}")
    public int delete(@PathVariable int id) {
        return userService.delete(id);
    }

    @RequestMapping("/update")
    public int update(  User user) {
        return userService.update(user);
    }

    @RequestMapping("/get/{id}")
    public User get(@PathVariable int id) {
        return userService.get(id);
    }

    @RequestMapping("/insert")
    public int insert( User user) {
        return userService.insert(user);
    }
}